{% extends "admin/index.html" %}
{% import "admin/admin_page.html" as pg %}

{% block script %}
<script>
    $(".selected").removeClass('selected');
    $("#leftNav").find("a:eq(3)").addClass("selected")
</script>
{% endblock %}

{% block content %}
<form method="POST" enctype="multipart/form-data">
    <!-- 添加菜品的小导航 -->
    <div class="switch">
        <a><label style="cursor:default" class="selectedswitch">
            {% block title %}
                添加菜品
            {% endblock %}
        </label></a>
    </div>
    {% for msg in get_flashed_messages(category_filter=["ok"]) %}
        <label style="color:#fe4a00;font-size: 14px;margin-left: 20px">
            {{ msg }} 
        </label>
    {% endfor %}
    <div class="button">
        <a class="breadhref" href="/admin/menus">
            返回
        </a>
        <a class="breadhef">
            {{ form.csrf_token }}
            {{ form.submit }}
        </a>
    </div>

    <!-- 添加菜单的内容 -->
    <div class="addmenu">
        <!-- 菜单及其验证 -->
        <div class="form-format">
            <p>{{ form.cname.label }}</p>
            <div>
                {{ form.cname }}
                {% for err in form.cname.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>

        <!-- 价格及验证 -->
        <div class="form-format">
            <p>{{ form.cprice.label }}</p>
            <div>
                {{ form.cprice }}
                {% for err in form.cprice.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>

        
        <!-- 主料及验证 -->
        <div class="form-format">
            <p>{{ form.ingredients.label }}</p>
            <div>
                {{ form.ingredients }}
                {% for err in form.ingredients.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>

        <!-- 口味及验证 -->
        <div class="form-format">
            <p>{{ form.taste.label }}</p>
            <div>
                {{ form.taste }}
                {% for err in form.taste.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>
        
        <!-- 积分及验证 -->
        <div class="form-format">
            <p>{{ form.points.label }}</p>
            <div>
                {{ form.points }}
                {% for err in form.points.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>


        <!-- 分类及验证 -->
        <div class="form-format">
            <p>{{ form.type.label }}</p>
            <div>
                {{ form.type }}
                {% for err in form.type.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>

        <!-- 库存及验证 -->
        <div class="form-format">
            <p>{{ form.stock.label }}</p>
            <div>
                {{ form.stock }}
                {% for err in form.stock.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>
        
        <!-- 订餐方式及验证 -->
        <div class="form-format">
            <p>{{ form.mealmeans.label }}</p>
            <div>
                {{ form.mealmeans }}
                {% for err in form.mealmeans.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>

        <!-- 图片及验证 -->
        <div class="form-format">
            <p>{{ form.images.label }}</p>
            <div>
                {{ form.images }}
                {% for err in form.images.errors %}
                    <span>{{ err }}</span>
                {% endfor %}
            </div>
        </div>
        <div class="form-format">
            {% block images %}
            {% endblock %}    
        </div>
        

        <div class="clear"></div>
    </div>
</form>
{% endblock %}